package org.geektimes.injection.context.Initializer;


import org.geektimes.injection.component.ComponentBean;
import org.geektimes.injection.context.ComponentContext;

import java.util.HashMap;
import java.util.Map;

/**
 * @FileName: DefaultComponentInitializer
 * @Description: 默认初始化器
 * @Author: MaWenHao
 * @Created: 2021/3/9 - 下午10:12
 */
public class DefaultComponentInitializer implements ComponentInitializer {

    /**
     * 
     */
    private Map<String, Object> controllersMapping = new HashMap<>();
    
    /**
     * 默认初始化器
     *
     * @param aClass
     * @return true
     */
    @Override
    public boolean match(Class<?> aClass) {
        return true;
    }

    /**
     * 初始化
     *
     * @param aClass
     */
    @Override
    public void init(Class<?> aClass, ComponentContext componentContext) throws Exception {
        componentContext.putComponent(aClass.getSimpleName(), new ComponentBean(aClass.newInstance()));
    }

}
